﻿@page "/"

@using export_to_xlsx_hierarchy.Models

@inject IJSRuntime JSRuntime

<TelerikGrid Data=@GridData
             Pageable="true"
             Groupable="true"
             Sortable="true"
             Resizable="true"
             Reorderable="true"
             PageSize="10"
             FilterMode="GridFilterMode.FilterMenu"
             AutoGenerateColumns="true">
    <GridToolBar>
        <GridCommandButton Command="ExportToExcel" Icon="file-excel" OnClick="ExportToExcel">Export To Excel</GridCommandButton>
        <TelerikDropDownList Data="formats" TItem="string" TValue="string" @bind-Value="SelectedFormat" />
    </GridToolBar>
    <GridColumns>
        <GridAutoGeneratedColumns />
    </GridColumns>
    <DetailTemplate>
        @{
            var product = context as Product;

            <TelerikGrid Data="@product.OrderDetails"
                         Pageable="true"
                         Sortable="true"
                         PageSize="5"
                         AutoGenerateColumns="true">
                <GridColumns>
                    <GridAutoGeneratedColumns />
                </GridColumns>
            </TelerikGrid>
        }
    </DetailTemplate>
</TelerikGrid>